#include <tsin/library/BulletDieEvent.hpp>

#include <tsin/runtime/GameRuntime.hpp>
#include <tsin/runtime/BulletRuntime.hpp>

#include <tsin/library/GameViewport.hpp>

#include <tsin/util/Logger.hpp>

#include <cstring>
#define _USE_MATH_DEFINES
#include <cmath>

using namespace tsin;

BulletDieEvent::BulletDieEvent(bool d)
        : BulletEvent(d)
{
}

DynamicObject *BulletDieEvent::copy()
{
        return DynamicObject::copy(new BulletDieEvent(true));
}

void BulletDieEvent::init()
{
}

void BulletDieEvent::reinit()
{
        switch(nrArguments) {
        case 0:
                init();
                break;
        }
}

bool BulletDieEvent::trigger(BulletRuntime &bullet, void *)
{
        return true;
}

BulletEvent *BulletDieEvent::handle(BulletRuntime &bullet, void *)
{
        bullet.stage = BULLET_STAGE_DIED;
        return next();
}

DynamicObject *bindDieEvent()
{
        return new BulletDieEvent(true);
}
